package demo08.Facade_pattern.entity;

/**
 * dvd实体
 * */
public class DvdPlayer {
	String description;
	int currentTrack;
	Amplifier amplifier;
	String movie;//
	
	public DvdPlayer(String description, Amplifier amplifier) {
		this.description = description;
		this.amplifier = amplifier;
	}
 
	public void on() {
		System.out.println(description + " 打开");
	}
 
	public void off() {
		System.out.println(description + " 关闭");
	}

        public void eject() {
		movie = null;
                System.out.println(description + " 弹出");
        }
 
	public void play(String movie) {
		this.movie = movie;
		currentTrack = 0;
		System.out.println(description + " 播放 \"" + movie + "\"");
	}

	public void play(int track) {
		if (movie == null) {
			System.out.println(description + " can't play track " + track + " 没有DVD插入");
		} else {
			currentTrack = track;
			System.out.println(description + " playing track " + currentTrack + " 关闭 \"" + movie + "\"");
		}
	}

	public void stop() {
		currentTrack = 0;
		System.out.println(description + " 停止 \"" + movie + "\"");
	}
 
	public void pause() {
		System.out.println(description + " 停下来 \"" + movie + "\"");
	}

	public void setTwoChannelAudio() {
		System.out.println(description + " 设置双声道音频");
	}
 
	public void setSurroundAudio() {
		System.out.println(description + " 设置环绕声");
	}
 
	public String toString() {
		return description;
	}
}
